home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib9
/
v_11_02
/
1102104a
< prev
next >
Wrap
Text File
|
1995-11-01
|
930b
|
46 lines
#include <stdio.h>
#define LABELSIZE 10
/* define matrix parameters */
#define ROWS 4
#define COLUMNS 7
#define VARIABLES 2
#define EQUATIONS 3
/* initialize matrix */
float table[ROWS][COLUMNS] = { 1,-2,-6,0,0,0,0,
0, 1, 0,1,0,0,4,
0, 0, 1,0,1,0,6,
0, 4, 3,0,0,1,24, };
/* char strings to hold labels */
char basis[LABELSIZE][LABELSIZE];
char objective[LABELSIZE][LABELSIZE];
/* used to build labels */
char var[LABELSIZE];
char num[LABELSIZE];
/* save info for leaving & entering var */
int leave_pos;
float leave_holder;
int enter_pos;
float enter_holder;
/* save info for pivot element */
float pivot_element;
/* count # of iterations */
int pass;
/* prototypes */
int select_entering(void);
int select_leaving(void);
void new_pivot(void);
void new_equation(void);
void build_basis(void);
void print_table(void);